/*
 * @Description: 
 * @Date: 2020-12-28 10:01:09
 * @LastEditors: lother
 * @LastEditTime: 2021-02-02 17:50:40
 * @FilePath: \VicoAccountOpening-H5\src\locales\index.js
 */
// 自动根据浏览器系统语言设置语言
const navLang = navigator.language
const localLang = (navLang === 'zh-CN' || navLang === 'en-US' || navLang === 'zh-TW') ? navLang : false
let lang = localStorage.getItem('lang') || localLang || 'zh-CN'


import Vue from 'vue'
import VueI18n from 'vue-i18n'
import en from './en';
import zhCN from './zh-cn';
import zhHK from './zh-HK';

import commonZh from './common/zh'
import commonEn from './common/en'
import commonTC from './common/tc'
 
Vue.use(VueI18n)
const messages = {
  'en-US': {
    ...en,
    ...commonEn
  },
  'zh-CN': {
    ...zhCN,
    ...commonZh
  },
  'zh-TW':{
    ...zhHK,
    ...commonTC,
  }
}
 
const i18n = new VueI18n({
    locale: lang, // set locale
    messages  // set locale messages
})
 
export default i18n